/*
 * @(#)CommBOImpl.java $version 2012-8-9
 * 
 * Copyright 2012 NADOSTAR Gruop. All rights Reserved.
 * NADOSTAR PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.nadostar.iims.etc.bo.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.nadostar.extensions.util.DataMap;
import com.nadostar.iims.etc.bo.CommBO;
import com.nadostar.iims.etc.dao.CommDAO;

/**
 * The Class CommBOImpl.
 * 
 * @author Lixing
 *
 */
@Service("CommBO")
@Transactional(readOnly = true)
public class CommBOImpl implements CommBO {
	private static Log log = LogFactory.getLog(CommBOImpl.class);
	
	@Autowired
	private CommDAO commDAO = null;
	
	public List<DataMap> getCommList(String commCdCatCd, int offset, int count) {
		List<DataMap> result = new ArrayList<DataMap>();
		try {
			result = commDAO.selectCommList(commCdCatCd, offset, count);
		} catch (Exception e) {
			log.error(e, e);
			return new ArrayList<DataMap>();
		}
		return result;
	}

	public int getCommListCount(String commCdCatCd) {
		try {
			return commDAO.selectCommListCount(commCdCatCd);
		} catch (Exception e) {
			log.error(e, e);
			return 0;
		}
	}

	public List<DataMap> getCommByCommCdCatList(String commCdCatCd) {
		List<DataMap> result = new ArrayList<DataMap>();
		try {
			result = commDAO.selectCommByCommCdCatList(commCdCatCd);
		} catch (Exception e) {
			log.error(e, e);
			return new ArrayList<DataMap>();
		}
		return result;
	}

	public List<DataMap> getAllCommCdCatList() {
		List<DataMap> result = new ArrayList<DataMap>();
		try {
			result = commDAO.selectAllCommCdCatList();
		} catch (Exception e) {
			log.error(e, e);
			return new ArrayList<DataMap>();
		}
		return result;
	}

}
